<html>
<head><meta charset="utf-8"><title>const generics in const fn · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html">const generics in const fn</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="193809394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809394">(Apr 13 2020 at 19:16)</a>:</h4>
<p>We currently forbid const generics in const fn:</p>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(const_generics)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR const parameters are not permitted in const functions</span>
<span class="w">    </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>This rationale for this is explain in the doc comment for <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_passes/ast_validation/struct.AstValidator.html#method.check_const_fn_const_generic" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_passes/ast_validation/struct.AstValidator.html#method.check_const_fn_const_generic">fn AstValidator::check_const_fn_const_generic</a>:</p>
<div class="codehilite"><pre><span></span>We currently do not permit const generics in const fn, as this is tantamount to allowing compile-time dependent typing.

FIXME(const_generics): Is this really true / necessary? Discuss with @varkor. At any rate, the restriction feels too syntactic. Consider moving it to e.g. typeck.
</pre></div>


<p>We can use the const param of an impl to circumvent this.</p>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(const_generics)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Indirect</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Indirect</span><span class="o">&lt;</span><span class="n">N</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">Indirect</span>::<span class="o">&lt;</span><span class="mi">7</span><span class="o">&gt;</span>::<span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>Is there a case where <code>foo::&lt;value&gt;()</code> can be used while <code>Indirect::&lt;value&gt;::foo()</code> is unusable?<br>
<span class="user-mention" data-user-id="121053">@varkor</span>  cc <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="193809565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809565">(Apr 13 2020 at 19:18)</a>:</h4>
<p>that comment doesn't make sense to me</p>



<a name="193809574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809574">(Apr 13 2020 at 19:18)</a>:</h4>
<p>you should be able to just remove the restriction</p>



<a name="193809583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809583">(Apr 13 2020 at 19:18)</a>:</h4>
<p>I had no idea we had it</p>



<a name="193809640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809640">(Apr 13 2020 at 19:18)</a>:</h4>
<p>also btw you need 0 <code>const fn</code> to compute consts from other consts</p>



<a name="193809691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809691">(Apr 13 2020 at 19:19)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(const_generics)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Indirect</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Indirect</span><span class="o">&lt;</span><span class="n">N</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="kt">u32</span> <span class="o">=</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">Indirect</span>::<span class="o">&lt;</span><span class="mi">7</span><span class="o">&gt;</span>::<span class="n">FOO</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="193809704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809704">(Apr 13 2020 at 19:19)</a>:</h4>
<p>this just works :P</p>



<a name="193809728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809728">(Apr 13 2020 at 19:19)</a>:</h4>
<p>(or I assume it does, I haven't tried it)</p>



<a name="193809940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193809940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193809940">(Apr 13 2020 at 19:21)</a>:</h4>
<p>Will try and go ahead with removing it them. <code>git blame</code> points to  <span class="user-mention" data-user-id="126931">@centril</span></p>



<a name="193810101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193810101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193810101">(Apr 13 2020 at 19:23)</a>:</h4>
<p>this just works :P <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=532a4d3d70bf6a5630175384a3c2d3a9" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=532a4d3d70bf6a5630175384a3c2d3a9">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=532a4d3d70bf6a5630175384a3c2d3a9</a></p>
<p>(I know it does, I have tried it)<br>
<span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="193814054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193814054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193814054">(Apr 13 2020 at 19:58)</a>:</h4>
<p>I also think we can just remove the restriction</p>



<a name="193818484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193818484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193818484">(Apr 13 2020 at 20:38)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/71109" title="https://github.com/rust-lang/rust/pull/71109">https://github.com/rust-lang/rust/pull/71109</a></p>



<a name="193820183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193820183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193820183">(Apr 13 2020 at 20:55)</a>:</h4>
<p>allowing const generics on const fn was deliberately not permitted for the initial version of const generics, cc <span class="user-mention" data-user-id="256759">@boats</span></p>



<a name="193820459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193820459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193820459">(Apr 13 2020 at 20:58)</a>:</h4>
<p>it <em>may</em> be safe to allow at some point, but it's not trivially safe, so we ought not to be so cavalier about it</p>



<a name="193820536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193820536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193820536">(Apr 13 2020 at 20:59)</a>:</h4>
<p>naïvely, a const function with a const generic parameter is a function whose type depends on a value in the same stage of compilation as it is executed, i.e. a dependent function</p>



<a name="193820644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193820644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193820644">(Apr 13 2020 at 21:00)</a>:</h4>
<p>I may have had a specific example I was concerned about, but I would have to think about it/try to find it</p>



<a name="193820791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193820791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193820791">(Apr 13 2020 at 21:00)</a>:</h4>
<p>at the very least, this is certainly a decision question — not something to accidentally permit without thinking through the consequences</p>



<a name="193821053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821053">(Apr 13 2020 at 21:02)</a>:</h4>
<p>it may be that as long as we push the obligations to the callers to verify correctness, as with <span class="user-mention" data-user-id="119009">@eddyb</span>'s WF bounds for consts, that this is okay — but even the WF bounds are an open design question at the moment</p>



<a name="193821105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821105">(Apr 13 2020 at 21:03)</a>:</h4>
<p>I don't understand what you're saying</p>



<a name="193821118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821118">(Apr 13 2020 at 21:03)</a>:</h4>
<p>how is this more dependent typing than anything else?</p>



<a name="193821139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821139">(Apr 13 2020 at 21:03)</a>:</h4>
<p>did you see the examples that use only associated consts?</p>



<a name="193821170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821170">(Apr 13 2020 at 21:03)</a>:</h4>
<p>in facts, by replacing const generics with types that implement a trait with associated consts, you can make examples that compile on stable</p>



<a name="193821275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821275">(Apr 13 2020 at 21:04)</a>:</h4>
<p>I don't understand the argument: the type of the function is not special at all, it's just another struct</p>



<a name="193821359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821359">(Apr 13 2020 at 21:05)</a>:</h4>
<p>there may be some confusion with <em>higher-ranked</em> things?</p>



<a name="193821394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821394">(Apr 13 2020 at 21:05)</a>:</h4>
<p>but we don't have <code>for&lt;const N: usize&gt;</code> or w/e yet, so that's not a concern</p>



<a name="193821490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821490">(Apr 13 2020 at 21:06)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> okay so trying to understand this, is the concern that an argument of a <code>const fn</code> may be used in a type?</p>



<a name="193821510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821510">(Apr 13 2020 at 21:06)</a>:</h4>
<p>e.g. <code>const fn(n: usize) -&gt; [T; n]</code>?</p>



<a name="193821571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821571">(Apr 13 2020 at 21:07)</a>:</h4>
<p>because 1. this is impossible today 2. this is impossible in general without full dependent typing, because <code>const fn</code>s are just <code>fn</code>s you can <em>also</em> call at compile-time</p>



<a name="193821582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821582">(Apr 13 2020 at 21:07)</a>:</h4>
<p>they still have to work with runtime values</p>



<a name="193821712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821712">(Apr 13 2020 at 21:08)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> dependent typing doesn't have anything to do with "stages of compilation", that's something else entirely</p>



<a name="193821723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821723">(Apr 13 2020 at 21:09)</a>:</h4>
<p>it's all about universes</p>



<a name="193821781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821781">(Apr 13 2020 at 21:09)</a>:</h4>
<p>or kinds, in Haskell terms</p>



<a name="193821942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821942">(Apr 13 2020 at 21:11)</a>:</h4>
<p>dependent typing at compile-time would be this:</p>
<div class="codehilite"><pre><span></span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="kt">u8</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w">  </span><span class="o">&amp;</span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">n</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">[</span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">n</span><span class="p">]</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>
</pre></div>



<a name="193821971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821971">(Apr 13 2020 at 21:11)</a>:</h4>
<p>and this is not something we allow or <em>could</em> allow any time soon</p>



<a name="193821995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193821995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193821995">(Apr 13 2020 at 21:11)</a>:</h4>
<p>sorry, I'll think about this soon</p>



<a name="193822185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822185">(Apr 13 2020 at 21:13)</a>:</h4>
<p>any type-level constants must come from <em>separate compile-time evaluation</em>. the separation is the important part, the compile-time is just because we're type-checking while compiling and the separation imposes a "happens before" relationship</p>



<a name="193822207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822207">(Apr 13 2020 at 21:13)</a>:</h4>
<p>and the separation can be modeled as lifting to kinds</p>



<a name="193822275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822275">(Apr 13 2020 at 21:14)</a>:</h4>
<p><code>const N: T</code> becomes <code>N: ConstValue&lt;T&gt;</code></p>



<a name="193822285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822285">(Apr 13 2020 at 21:14)</a>:</h4>
<p>using <code>N</code> becomes <code>N::VALUE</code></p>



<a name="193822324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822324">(Apr 13 2020 at 21:15)</a>:</h4>
<p>(Haskell can use kinds for this, we can only mess around with traits :P)</p>



<a name="193822490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822490">(Apr 13 2020 at 21:16)</a>:</h4>
<p>wow I got really worked up about dependent typing huh</p>



<a name="193822607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822607">(Apr 13 2020 at 21:17)</a>:</h4>
<p>I guess seeing that explanation broke my brain a bit the second time since the first time I thought it was some confusion</p>



<a name="193822659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193822659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193822659">(Apr 13 2020 at 21:18)</a>:</h4>
<p>or misunderstanding</p>



<a name="193823085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823085">(Apr 13 2020 at 21:22)</a>:</h4>
<p>I admit: I had a knee-jerk reaction because I remember having a worry about this setting; but I need to think about what exactly the issue was — I thought it was better to delay bors for an hour or two than to have to back a change out because something was actually unsound</p>



<a name="193823118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823118">(Apr 13 2020 at 21:22)</a>:</h4>
<p>it could well be that the case I was worried about is not possible without interacting with another feature we don't have</p>



<a name="193823140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823140">(Apr 13 2020 at 21:23)</a>:</h4>
<p>but I'm in the middle of something at the moment, so it'll take me a little while to concentrate on this</p>



<a name="193823319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823319">(Apr 13 2020 at 21:25)</a>:</h4>
<p>yeah no worries</p>



<a name="193823372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823372">(Apr 13 2020 at 21:26)</a>:</h4>
<p>I'm happy with delaying until we can figure out how that reasoning came to be</p>



<a name="193823489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823489">(Apr 13 2020 at 21:26)</a>:</h4>
<p>it just struck me as not meaning anything. if anything, any restriction should be for the benefit of <code>min_const_fn</code> (which bans e.g. trait bounds), not  <code>const</code> generics</p>



<a name="193823731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193823731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193823731">(Apr 13 2020 at 21:29)</a>:</h4>
<p>I imagine the rationale was that <code>const fn foo&lt;const X: usize&gt;() -&gt; [(); X]</code> corresponds to something like <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mo>∏</mo><mrow><mi>x</mi><mo>:</mo><mrow><mi mathvariant="normal">u</mi><mi mathvariant="normal">s</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">z</mi><mi mathvariant="normal">e</mi></mrow></mrow></msub><mrow><mi mathvariant="normal">A</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">y</mi></mrow><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\prod_{x : \mathrm{usize}} \mathrm{Array}(x)</annotation></semantics></math></span><span aria-hidden="true" class="katex-html"><span class="base"><span class="strut" style="height:1.0497100000000001em;vertical-align:-0.29971000000000003em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∏</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.16779199999999994em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathdefault mtight">x</span><span class="mrel mtight">:</span><span class="mord mtight"><span class="mord mathrm mtight">u</span><span class="mord mathrm mtight">s</span><span class="mord mathrm mtight">i</span><span class="mord mathrm mtight">z</span><span class="mord mathrm mtight">e</span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.29971000000000003em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathrm">A</span><span class="mord mathrm">r</span><span class="mord mathrm">r</span><span class="mord mathrm">a</span><span class="mord mathrm" style="margin-right:0.01389em;">y</span></span><span class="mopen">(</span><span class="mord mathdefault">x</span><span class="mclose">)</span></span></span></span></p>



<a name="193825755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825755">(Apr 13 2020 at 21:48)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> well it does, but of course there's a compile time restriction on the <code>usize</code> there</p>



<a name="193825776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825776">(Apr 13 2020 at 21:49)</a>:</h4>
<p>I thought when we last discussed this in private that there was no problem</p>



<a name="193825818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825818">(Apr 13 2020 at 21:49)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> except you can write that without <code>const fn</code></p>



<a name="193825840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825840">(Apr 13 2020 at 21:49)</a>:</h4>
<p>I don't remember; everything is so out of cache, I need to try to reconstruct it to make sure my worries are unfounded</p>



<a name="193825845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825845">(Apr 13 2020 at 21:49)</a>:</h4>
<p>that's just an associated <code>const</code></p>



<a name="193825856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825856">(Apr 13 2020 at 21:49)</a>:</h4>
<p>At any rate, the syntactic condition in AST validation is insufficient -- it does not consider <code>impl</code>s and whatnot -- if you actually want to enforce this you should move it to <code>rustc_typeck</code></p>



<a name="193825861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825861">(Apr 13 2020 at 21:50)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>: right, that's what I'm currently thinking about</p>



<a name="193825947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825947">(Apr 13 2020 at 21:50)</a>:</h4>
<p>there's no <em>actual</em> \Pi, since that would work with any values</p>



<a name="193825948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825948">(Apr 13 2020 at 21:50)</a>:</h4>
<p>(well I suppose you can enforce it in AST validation as well, but you'll need a more elaborate check)</p>



<a name="193825991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193825991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193825991">(Apr 13 2020 at 21:50)</a>:</h4>
<p>it's more like <code>x: const usize</code></p>



<a name="193826011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826011">(Apr 13 2020 at 21:51)</a>:</h4>
<p>where <code>const usize</code> is an universe/kind of lifted values of type <code>usize</code></p>



<a name="193826042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826042">(Apr 13 2020 at 21:51)</a>:</h4>
<p>I think the Haskell analogue of const generics is <code>{-# LANGUAGE DataKinds #-}</code></p>



<a name="193826050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826050">(Apr 13 2020 at 21:51)</a>:</h4>
<p>yupp</p>



<a name="193826057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826057">(Apr 13 2020 at 21:51)</a>:</h4>
<p>that's what I'm referring to</p>



<a name="193826063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826063">(Apr 13 2020 at 21:51)</a>:</h4>
<p>Yeah <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="193826072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826072">(Apr 13 2020 at 21:52)</a>:</h4>
<p>I just always forget they're <em>data</em> kinds since I think of this as "const kinds" :P</p>



<a name="193826153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826153">(Apr 13 2020 at 21:52)</a>:</h4>
<p>anyway you can lift every value to type-encoded ADTs</p>



<a name="193826164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826164">(Apr 13 2020 at 21:52)</a>:</h4>
<p>basically what <code>typenum</code> does but formalized</p>



<a name="193826217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826217">(Apr 13 2020 at 21:53)</a>:</h4>
<p>this is why we need structurally matcheable ADT constructor trees with integer leaves</p>



<a name="193826243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826243">(Apr 13 2020 at 21:53)</a>:</h4>
<p>and integers are only allowable because of the <code>Nat</code> ADT :P</p>



<a name="193826390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826390">(Apr 13 2020 at 21:55)</a>:</h4>
<p>What we have is basically a new kind constructor <code>Const : Type_Const -&gt; Kind</code></p>



<a name="193826399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193826399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193826399">(Apr 13 2020 at 21:55)</a>:</h4>
<p>where <code>_Const</code> denotes the lifting</p>



<a name="193827650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827650">(Apr 13 2020 at 22:08)</a>:</h4>
<p>I suppose something like this is what I had previously been thinking of:</p>
<div class="codehilite"><pre><span></span><span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">(</span><span class="n">x</span>: <span class="kt">usize</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">X</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[();</span><span class="w"> </span><span class="n">X</span><span class="p">]</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">[();</span><span class="w"> </span><span class="n">bar</span><span class="p">(</span><span class="n">X</span><span class="p">)]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>sorry, my mind is somewhere else right now, so I'm not thinking entirely clearly</p>



<a name="193827728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827728">(Apr 13 2020 at 22:09)</a>:</h4>
<p>what is currently preventing this code from compiling if the const generics in <code>const fn</code> check is removed?</p>



<a name="193827881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827881">(Apr 13 2020 at 22:10)</a>:</h4>
<p>that looks like correct code to me, I don't know what you mean</p>



<a name="193827908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827908">(Apr 13 2020 at 22:11)</a>:</h4>
<p>this is entirely possible in an associated <code>const</code></p>



<a name="193827951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827951">(Apr 13 2020 at 22:11)</a>:</h4>
<p><code>bar(X)</code> is not at the value level of <code>foo</code></p>



<a name="193827956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827956">(Apr 13 2020 at 22:11)</a>:</h4>
<p>it's lifted</p>



<a name="193827961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827961">(Apr 13 2020 at 22:11)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=ed8aaace308dec4475c1b46d5337cd99" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=ed8aaace308dec4475c1b46d5337cd99">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=ed8aaace308dec4475c1b46d5337cd99</a></p>



<a name="193827986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193827986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193827986">(Apr 13 2020 at 22:12)</a>:</h4>
<p>oh lmao</p>



<a name="193828028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828028">(Apr 13 2020 at 22:12)</a>:</h4>
<div class="codehilite"><pre><span></span>error[E0308]: mismatched types
  --&gt; src/lib.rs:11:9
   |
10 |     const fn foo() -&gt; [(); X] {
   |                       ------- expected `[(); _]` because of return type
11 |         [(); bar(X)]
   |         ^^^^^^^^^^^^ expected `X`, found `bar(X)`
   |
   = note: expected array `[(); _]`
              found array `[(); _]`
</pre></div>



<a name="193828037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828037">(Apr 13 2020 at 22:12)</a>:</h4>
<p>right, we don't simplify <code>bar(X)</code> to <code>X</code></p>



<a name="193828091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828091">(Apr 13 2020 at 22:12)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> so as you see, the current check isn't actually enforcing anything <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="193828119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828119">(Apr 13 2020 at 22:13)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=33b2deb1b5946d98d8f204e9882d3626" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=33b2deb1b5946d98d8f204e9882d3626">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=33b2deb1b5946d98d8f204e9882d3626</a></p>



<a name="193828237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828237">(Apr 13 2020 at 22:14)</a>:</h4>
<p>okay, let's leave aside that the current check is flawed: obviously that's a bug with the check, unrelated to the intention</p>



<a name="193828245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828245">(Apr 13 2020 at 22:14)</a>:</h4>
<p>not only are <code>const fn</code>s w/o arguments isomorphic to associated <code>const</code>s with <code>#[feature(const_fn)]</code>, they're actually more restricted thanks to <code>min_const_fn</code> :P</p>



<a name="193828285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828285">(Apr 13 2020 at 22:14)</a>:</h4>
<p>I don't know why you'd even bother with <code>const fn</code>s when associated <code>const</code>s exist</p>



<a name="193828295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828295">(Apr 13 2020 at 22:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828037" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828037">said</a>:</p>
<blockquote>
<p>right, we don't simplify <code>bar(X)</code> to <code>X</code></p>
</blockquote>
<p>right, but this is a restriction with const generics at the moment</p>



<a name="193828298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828298">(Apr 13 2020 at 22:14)</a>:</h4>
<p>surely if there is a problem in having const-generic constants, that would be it?</p>



<a name="193828304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828304">(Apr 13 2020 at 22:14)</a>:</h4>
<p>we don't always intend to have a completely syntactic check</p>



<a name="193828376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828376">(Apr 13 2020 at 22:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828298" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828298">said</a>:</p>
<blockquote>
<p>surely if there is a problem in having const-generic constants, that would be it?</p>
</blockquote>
<p>I could believe that we're too liberal with associated constants and const generics at the moment</p>



<a name="193828377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828377">(Apr 13 2020 at 22:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828285" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193828285">said</a>:</p>
<blockquote>
<p>I don't know why you'd even bother with <code>const fn</code>s when associated <code>const</code>s exist</p>
</blockquote>
<p>Convenience and code reuse?</p>



<a name="193828401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828401">(Apr 13 2020 at 22:15)</a>:</h4>
<p>no, I mean the checks needed from <span class="user-mention" data-user-id="121053">@varkor</span>'s PoV</p>



<a name="193828467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828467">(Apr 13 2020 at 22:16)</a>:</h4>
<p>why would you bother banning <code>const</code> generics in scope of <code>const fn</code>s when they can also exist in scope of associated <code>const</code>s</p>



<a name="193828503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828503">(Apr 13 2020 at 22:16)</a>:</h4>
<p>yeah, I agree</p>



<a name="193828514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828514">(Apr 13 2020 at 22:16)</a>:</h4>
<p>I think maybe we should ban const generics in associated constants</p>



<a name="193828532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828532">(Apr 13 2020 at 22:17)</a>:</h4>
<p>okay now you have to convince me there is a reason to :)</p>



<a name="193828590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828590">(Apr 13 2020 at 22:17)</a>:</h4>
<p>okay, so I don't think there is any fear of this causing unsoundness</p>



<a name="193828596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828596">(Apr 13 2020 at 22:18)</a>:</h4>
<p>I was worried you had something complicated involving <em>arguments</em> but if you think this restriction is needed by associated <code>const</code>s, I think I can safely say I believe you're mistaken :P</p>



<a name="193828645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828645">(Apr 13 2020 at 22:18)</a>:</h4>
<p>this is a safe underapproximation</p>



<a name="193828670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828670">(Apr 13 2020 at 22:18)</a>:</h4>
<p>but if we ever lift the syntactic restriction, i.e. the two terms must be identical, then we have issues with type checking</p>



<a name="193828694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828694">(Apr 13 2020 at 22:18)</a>:</h4>
<p>we have to rely on a limited form of symbolic execution</p>



<a name="193828695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828695">(Apr 13 2020 at 22:18)</a>:</h4>
<p>this is fine with me even if <code>bar(X)</code> normalizes to <code>X</code></p>



<a name="193828703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828703">(Apr 13 2020 at 22:19)</a>:</h4>
<p>how so?</p>



<a name="193828710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828710">(Apr 13 2020 at 22:19)</a>:</h4>
<p><code>bar(X)</code> is not part of the parent body</p>



<a name="193828721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828721">(Apr 13 2020 at 22:19)</a>:</h4>
<p>because imagine <code>bar</code> is more complicated than the identity</p>



<a name="193828733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828733">(Apr 13 2020 at 22:19)</a>:</h4>
<p>it's some arbitrary function</p>



<a name="193828736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828736">(Apr 13 2020 at 22:19)</a>:</h4>
<p><code>let x = bar(X); [(); x]</code> will never work</p>



<a name="193828745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828745">(Apr 13 2020 at 22:19)</a>:</h4>
<p>we can't work out what it will return</p>



<a name="193828780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828780">(Apr 13 2020 at 22:19)</a>:</h4>
<p>are you saying <code>[(); bar(X)]</code> will never work?</p>



<a name="193828785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828785">(Apr 13 2020 at 22:19)</a>:</h4>
<p>no</p>



<a name="193828796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828796">(Apr 13 2020 at 22:19)</a>:</h4>
<p>right</p>



<a name="193828874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828874">(Apr 13 2020 at 22:20)</a>:</h4>
<p>okay, I suppose this issue already exists, because we can have arbitrary expressions in the repeat parameter</p>



<a name="193828880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828880">(Apr 13 2020 at 22:20)</a>:</h4>
<p>if it starts working, it will work all the same whether <code>const fn</code> or regular <code>fn</code></p>



<a name="193828907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828907">(Apr 13 2020 at 22:20)</a>:</h4>
<p>there is nothing about "this code may execute at compile-time" that changes any of this</p>



<a name="193828966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828966">(Apr 13 2020 at 22:21)</a>:</h4>
<p>if <code>unify(bar(X), X)</code> will ever work it will be something mostly-syntactic on MIR most likely</p>



<a name="193828985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193828985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193828985">(Apr 13 2020 at 22:21)</a>:</h4>
<p>symbolic evaluation is hard :P</p>



<a name="193829016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829016">(Apr 13 2020 at 22:21)</a>:</h4>
<p>maybe…</p>



<a name="193829023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829023">(Apr 13 2020 at 22:21)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> we'd need to RFC some sort of definitional equality or so</p>



<a name="193829044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829044">(Apr 13 2020 at 22:21)</a>:</h4>
<p>for "mostly syntactic on MIR"</p>



<a name="193829051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829051">(Apr 13 2020 at 22:22)</a>:</h4>
<p>yeah sure, my point is</p>



<a name="193829103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829103">(Apr 13 2020 at 22:22)</a>:</h4>
<p>none of this has anything to do with <code>const fn</code>s or associated <code>const</code>s</p>



<a name="193829111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829111">(Apr 13 2020 at 22:22)</a>:</h4>
<p>I agree with your point <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="193829118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829118">(Apr 13 2020 at 22:22)</a>:</h4>
<p>I thought you were talking as if <code>bar(X)</code> is part of the parent body</p>



<a name="193829140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829140">(Apr 13 2020 at 22:22)</a>:</h4>
<p>otherwise none of this "dependent typing" talk makes any sense</p>



<a name="193829153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829153">(Apr 13 2020 at 22:22)</a>:</h4>
<p>I think that my main issue was that type-checking could become (even more) undecidable, but I think this boils down to <code>unify(bar(X), X)</code>, as you say, which was already an existing issue already</p>



<a name="193829161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829161">(Apr 13 2020 at 22:22)</a>:</h4>
<p><code>let x = bar(X); [(); x]</code> is dependent typing</p>



<a name="193829186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829186">(Apr 13 2020 at 22:23)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> but you can just remove the <code>const</code> from the <code>const fn</code> and now it's not a <code>const fn</code></p>



<a name="193829194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829194">(Apr 13 2020 at 22:23)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span>  what does "even more undecidable" mean lol? :D</p>



<a name="193829196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829196">(Apr 13 2020 at 22:23)</a>:</h4>
<p>and nothing changes about type-checking it</p>



<a name="193829209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829209">(Apr 13 2020 at 22:23)</a>:</h4>
<p><code>[(); { expression }]</code> is dependent typing</p>



<a name="193829223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829223">(Apr 13 2020 at 22:23)</a>:</h4>
<p>ah that's where your confusion stems from</p>



<a name="193829233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829233">(Apr 13 2020 at 22:23)</a>:</h4>
<p>it's only if <code>expression</code> can refer to non-generics</p>



<a name="193829243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829243">(Apr 13 2020 at 22:24)</a>:</h4>
<p>I think "dependent typing" isn't one thing; you can have degrees of dependent typing...</p>



<a name="193829273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829273">(Apr 13 2020 at 22:24)</a>:</h4>
<p>but it can't</p>



<a name="193829286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829286">(Apr 13 2020 at 22:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="126931">centril</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829194" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829194">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="121053">varkor</span>  what does "even more undecidable" mean lol? :D</p>
</blockquote>
<p>I thought you would correct me if I said "make it undecidable", as it already is</p>



<a name="193829306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829306">(Apr 13 2020 at 22:24)</a>:</h4>
<p>that's why I'm saying <code>let x = bar(X); [(); x]</code> and <code>[(); bar(X)]</code> are <em>very different</em></p>



<a name="193829323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829323">(Apr 13 2020 at 22:24)</a>:</h4>
<p>the former is dependent-typing, no matter when <code>let x</code> may be evaluated</p>



<a name="193829333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829333">(Apr 13 2020 at 22:25)</a>:</h4>
<p>And Haskell via DataKinds certainly have some sorta dependent typing; <a href="https://www.youtube.com/watch?v=wNa3MMbhwS4" title="https://www.youtube.com/watch?v=wNa3MMbhwS4">https://www.youtube.com/watch?v=wNa3MMbhwS4</a></p>
<div class="youtube-video message_inline_image"><a data-id="wNa3MMbhwS4" href="https://www.youtube.com/watch?v=wNa3MMbhwS4" title="https://www.youtube.com/watch?v=wNa3MMbhwS4"><img src="https://i.ytimg.com/vi/wNa3MMbhwS4/default.jpg"></a></div>



<a name="193829336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829336">(Apr 13 2020 at 22:25)</a>:</h4>
<p>the latter is just data kinds</p>



<a name="193829340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829340">(Apr 13 2020 at 22:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829233" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829233">said</a>:</p>
<blockquote>
<p>it's only if <code>expression</code> can refer to non-generics</p>
</blockquote>
<p>the generics can be arbitrary values, which means the type depends on some computation, whose value is not known without running some arbitrary code</p>



<a name="193829369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829369">(Apr 13 2020 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> but you can lift <em>all of that</em> to types</p>



<a name="193829374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829374">(Apr 13 2020 at 22:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829306" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829306">said</a>:</p>
<blockquote>
<p>that's why I'm saying <code>let x = bar(X); [(); x]</code> and <code>[(); bar(X)]</code> are <em>very different</em></p>
</blockquote>
<p>I agree they are, and the former is much worse — but to some extend the latter is still dependent</p>



<a name="193829384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829384">(Apr 13 2020 at 22:25)</a>:</h4>
<p>if you couldn't, <em>then</em> it would be dependent</p>



<a name="193829399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829399">(Apr 13 2020 at 22:25)</a>:</h4>
<p>it's very important to understand where the value-level boundary lies</p>



<a name="193829448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829448">(Apr 13 2020 at 22:26)</a>:</h4>
<p><code>X</code> is <em>not</em> in the value level!</p>



<a name="193829464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829464">(Apr 13 2020 at 22:26)</a>:</h4>
<p>I understand your distinction</p>



<a name="193829479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829479">(Apr 13 2020 at 22:26)</a>:</h4>
<p>okay then you should understand there is no concern here :P</p>



<a name="193829486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829486">(Apr 13 2020 at 22:26)</a>:</h4>
<p>and no dependent typing</p>



<a name="193829487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829487">(Apr 13 2020 at 22:26)</a>:</h4>
<p>and I realise that it makes a practical difference</p>



<a name="193829498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829498">(Apr 13 2020 at 22:26)</a>:</h4>
<p>there is a theoretical name for what const generics are but I've forgotten it</p>



<a name="193829501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829501">(Apr 13 2020 at 22:26)</a>:</h4>
<p>but now I'm just thinking about the terminological difference :P</p>



<a name="193829502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829502">(Apr 13 2020 at 22:26)</a>:</h4>
<p>brb bugging eternaleye about it</p>



<a name="193829508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829508">(Apr 13 2020 at 22:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="121053">varkor</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829286" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829286">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="126931">centril</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829194" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829194">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="121053">varkor</span>  what does "even more undecidable" mean lol? :D</p>
</blockquote>
<p>I thought you would correct me if I said "make it undecidable", as it already is</p>
</blockquote>
<p>Just thought it a bit funny in the sense of "infinity + 1"</p>



<a name="193829518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829518">(Apr 13 2020 at 22:27)</a>:</h4>
<p>:P</p>



<a name="193829529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829529">(Apr 13 2020 at 22:27)</a>:</h4>
<p>"add more ways for it to be undecidable"</p>



<a name="193829533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829533">(Apr 13 2020 at 22:27)</a>:</h4>
<p>inb4 this becomes ordinals vs cardinals</p>



<a name="193829552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829552">(Apr 13 2020 at 22:27)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> maybe "more conveniently undecidable" ;)</p>



<a name="193829690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829690">(Apr 13 2020 at 22:29)</a>:</h4>
<p><em>"In this release of Rust, we have made undecidability at the type level more accessible to all users"</em></p>



<a name="193829697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829697">(Apr 13 2020 at 22:29)</a>:</h4>
<p>also I don't think MIR-driven unification is undecidable, only CTFE is</p>



<a name="193829751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829751">(Apr 13 2020 at 22:29)</a>:</h4>
<p>my only interest in MIR-driven unification is treating two constant expressions written and type-checked the same, but in two different places, like they're equal</p>



<a name="193829831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829831">(Apr 13 2020 at 22:30)</a>:</h4>
<p>okay, eternaleye replied</p>



<a name="193829853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829853">(Apr 13 2020 at 22:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829751" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193829751">said</a>:</p>
<blockquote>
<p>my only interest in MIR-driven unification is treating two constant expressions written and type-checked the same, but in two different places, like they're equal</p>
</blockquote>
<p>I personally would quite like symbolic execution, but I can see that that's a more contentious issue</p>



<a name="193829867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193829867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193829867">(Apr 13 2020 at 22:30)</a>:</h4>
<p>we can start simple <em>shrug</em></p>



<a name="193830046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830046">(Apr 13 2020 at 22:32)</a>:</h4>
<p>oh god now I can't find it</p>



<a name="193830079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830079">(Apr 13 2020 at 22:33)</a>:</h4>
<p>no I don't want spirituality results</p>



<a name="193830241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830241">(Apr 13 2020 at 22:35)</a>:</h4>
<p>awww apparently it's only in talks</p>



<a name="193830345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830345">(Apr 13 2020 at 22:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830079" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830079">said</a>:</p>
<blockquote>
<p>no I don't want spirituality results</p>
</blockquote>
<p>what? :P</p>



<a name="193830373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830373">(Apr 13 2020 at 22:37)</a>:</h4>
<p>something about having contacts in the spirit world</p>



<a name="193830478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830478">(Apr 13 2020 at 22:38)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  are we talking McBride's spirit world?</p>



<a name="193830480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830480">(Apr 13 2020 at 22:38)</a>:</h4>
<p>anyway <a href="https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf" title="https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf">https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf</a> is kind of interesting</p>



<a name="193830499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830499">(Apr 13 2020 at 22:39)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> oh yeah I haven't said his name yet</p>



<a name="193830578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830578">(Apr 13 2020 at 22:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830373" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830373">said</a>:</p>
<blockquote>
<p>something about having contacts in the spirit world</p>
</blockquote>
<p>I never thought spirits would be relevant to Rust :P</p>



<a name="193830627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830627">(Apr 13 2020 at 22:40)</a>:</h4>
<p>it's how McBride refers to the kind of lifting here, apparently</p>



<a name="193830645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830645">(Apr 13 2020 at 22:40)</a>:</h4>
<p>I was just hoping for something easier to point at, like a blog post or paper :P</p>



<a name="193830649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830649">(Apr 13 2020 at 22:40)</a>:</h4>
<p>I see :P</p>



<a name="193830697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830697">(Apr 13 2020 at 22:41)</a>:</h4>
<p><em>sigh</em></p>



<a name="193830790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830790">(Apr 13 2020 at 22:42)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> actually, I just got a flashback</p>



<a name="193830822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830822">(Apr 13 2020 at 22:42)</a>:</h4>
<p>were you maybe concerned about <em>calling</em> <code>const fn</code>s in <code>AnonConst</code>s used in types?</p>



<a name="193830844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830844">(Apr 13 2020 at 22:43)</a>:</h4>
<p>as this would make more sense overall IMO</p>



<a name="193830877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830877">(Apr 13 2020 at 22:43)</a>:</h4>
<p>even regular <code>const fn</code>, not necessarily ones parameterized by <code>const</code> generics, even completely monomorphic</p>



<a name="193830897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830897">(Apr 13 2020 at 22:43)</a>:</h4>
<p>was surprised to see you bring up const unification but this would explain it</p>



<a name="193830970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830970">(Apr 13 2020 at 22:44)</a>:</h4>
<p>this is not an unreasonable way to limit <code>const</code> unification, if we had it :P</p>



<a name="193830975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193830975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193830975">(Apr 13 2020 at 22:44)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> that is something like <code>TypeCtor&lt;{const_fn::&lt;ConstExpr&gt;()}&gt;</code>?</p>



<a name="193831022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831022">(Apr 13 2020 at 22:45)</a>:</h4>
<p>even <code>TypeCtor&lt;{const_fn(V)}&gt;</code>, assuming <code>V</code> is a <code>const</code> param</p>



<a name="193831046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831046">(Apr 13 2020 at 22:45)</a>:</h4>
<p>don't have those (outside of the intrinsics), and doesn't matter?</p>



<a name="193831057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831057">(Apr 13 2020 at 22:45)</a>:</h4>
<p>don't have what?</p>



<a name="193831122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831122">(Apr 13 2020 at 22:46)</a>:</h4>
<p>non-implied <code>const</code> params</p>



<a name="193831127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831127">(Apr 13 2020 at 22:46)</a>:</h4>
<p>I'm talking about literally <code>Array&lt;T, {add(N, 1)}&gt;</code></p>



<a name="193831137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831137">(Apr 13 2020 at 22:46)</a>:</h4>
<p>being disallowed but <code>Array&lt;T, {N+1}&gt;</code> allowed</p>



<a name="193831138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831138">(Apr 13 2020 at 22:46)</a>:</h4>
<p>oh</p>



<a name="193831165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831165">(Apr 13 2020 at 22:47)</a>:</h4>
<p>this is the only way I can understand <span class="user-mention" data-user-id="121053">@varkor</span>'s protests wrt the <code>bar(X)</code> example</p>



<a name="193831181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831181">(Apr 13 2020 at 22:47)</a>:</h4>
<p>since clearly where that array shows up is unimportant: type-check works the same way</p>



<a name="193831190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831190">(Apr 13 2020 at 22:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830822" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830822">said</a>:</p>
<blockquote>
<p>were you maybe concerned about <em>calling</em> <code>const fn</code>s in <code>AnonConst</code>s used in types?</p>
</blockquote>
<p>yes</p>



<a name="193831207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831207">(Apr 13 2020 at 22:47)</a>:</h4>
<p>/me gives out a sigh of relief</p>



<a name="193831258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831258">(Apr 13 2020 at 22:48)</a>:</h4>
<p>oh, actually, you're right: it is of course different to consider functions rather than expressions</p>



<a name="193831270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831270">(Apr 13 2020 at 22:48)</a>:</h4>
<p>and yeah right now such expressions are quite useless so they're implicitly banned anyway :P</p>



<a name="193831285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831285">(Apr 13 2020 at 22:48)</a>:</h4>
<p>sorry, my sleeping schedule has gone out the window recently, and my mind obviously hasn't benefited from that :P</p>



<a name="193831290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831290">(Apr 13 2020 at 22:48)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  but what does <code>add(N, 1)</code> here have to do with the check in AST validation?</p>



<a name="193831300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831300">(Apr 13 2020 at 22:48)</a>:</h4>
<p>nothing!</p>



<a name="193831303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831303">(Apr 13 2020 at 22:48)</a>:</h4>
<p>that check is still confused IMO</p>



<a name="193831322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831322">(Apr 13 2020 at 22:49)</a>:</h4>
<p>but I just found the link between <code>const fn</code>s and <code>const</code> generics :P</p>



<a name="193831325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831325">(Apr 13 2020 at 22:49)</a>:</h4>
<p>right; so we should nix it</p>



<a name="193831361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831361">(Apr 13 2020 at 22:49)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> same and I've been meaning to sleep even before all of this kept me awake :P</p>



<a name="193831391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831391">(Apr 13 2020 at 22:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830970" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830970">said</a>:</p>
<blockquote>
<p>this is not an unreasonable way to limit <code>const</code> unification, if we had it :P</p>
</blockquote>
<p>right, I think you've managed to decipher my incoherent thought patterns, thank you <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="193831479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831479">(Apr 13 2020 at 22:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831303" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831303">said</a>:</p>
<blockquote>
<p>that check is still confused IMO</p>
</blockquote>
<p>I'm pretty sure it was added as an afterthought, so this doesn't surprise me</p>



<a name="193831694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831694">(Apr 13 2020 at 22:53)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  not sure why we would disallow <code>add(N, 1)</code> though</p>



<a name="193831698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831698">(Apr 13 2020 at 22:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="121053">varkor</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831391" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831391">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830970" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193830970">said</a>:</p>
<blockquote>
<p>this is not an unreasonable way to limit <code>const</code> unification, if we had it :P</p>
</blockquote>
<p>right, I think you've managed to decipher my incoherent thought patterns, thank you <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>
</blockquote>
<p>it literally came to me in a flashback so maybe I remembered a previous discussion</p>



<a name="193831750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831750">(Apr 13 2020 at 22:54)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> only once we get <code>const</code> unification, and maybe we won't ban it</p>



<a name="193831822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831822">(Apr 13 2020 at 22:55)</a>:</h4>
<p>you'd need to expose the body of the <code>const fn</code> to look inside it if you e.g., want to unify <code>add(N, 1) ~ add(1, N)</code></p>



<a name="193831879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831879">(Apr 13 2020 at 22:56)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> so our conclusion is to r+ the PR again?</p>



<a name="193831905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831905">(Apr 13 2020 at 22:56)</a>:</h4>
<p>btw <code>add(1, 3)</code> is clearly fine, it's only the "dependence" on <code>const</code> parameters that's dubious :P</p>



<a name="193831914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831914">(Apr 13 2020 at 22:57)</a>:</h4>
<p>yeah</p>



<a name="193831920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831920">(Apr 13 2020 at 22:57)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  btw, "<code>const</code> parameters" is highly ambiguous :P</p>



<a name="193831928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831928">(Apr 13 2020 at 22:57)</a>:</h4>
<p>how so?</p>



<a name="193831940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831940">(Apr 13 2020 at 22:57)</a>:</h4>
<p>I use backticks to mean <code>const X: T</code></p>



<a name="193831941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831941">(Apr 13 2020 at 22:57)</a>:</h4>
<p>I would call it "<code>const</code> arguments"</p>



<a name="193831997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831997">(Apr 13 2020 at 22:58)</a>:</h4>
<p>its the argument that is a constant; not the parameter?</p>



<a name="193831999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193831999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193831999">(Apr 13 2020 at 22:58)</a>:</h4>
<p>but that's not in the definition</p>



<a name="193832012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832012">(Apr 13 2020 at 22:58)</a>:</h4>
<p>uhhhhh</p>



<a name="193832030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832030">(Apr 13 2020 at 22:58)</a>:</h4>
<p>I mean generic parameters declared with the keyword <code>const</code></p>



<a name="193832048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832048">(Apr 13 2020 at 22:58)</a>:</h4>
<p>I wouldn't use <code>this style</code> if I meant "const" more informally</p>



<a name="193832052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832052">(Apr 13 2020 at 22:58)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  oh, <code>fn foo(const N: usize)</code>?</p>



<a name="193832057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832057">(Apr 13 2020 at 22:59)</a>:</h4>
<p>no</p>



<a name="193832077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832077">(Apr 13 2020 at 22:59)</a>:</h4>
<p><code>fn foo&lt;const N: usize&gt;</code></p>



<a name="193832093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832093">(Apr 13 2020 at 22:59)</a>:</h4>
<p>or <code>struct Foo&lt;const N: usize&gt;;</code></p>



<a name="193832097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832097">(Apr 13 2020 at 22:59)</a>:</h4>
<p>oh; dependence on const parameters... never mind me</p>



<a name="193832690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832690">(Apr 13 2020 at 23:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="126931">centril</span> <a href="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831879" title="#narrow/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn/near/193831879">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="121053">varkor</span> so our conclusion is to r+ the PR again?</p>
</blockquote>
<p>yes, I think this is fine<br>
we should record a note about const unification and calling const functions somewhere — do we have anywhere we're tracking comments about unification yet?</p>



<a name="193832719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832719">(Apr 13 2020 at 23:05)</a>:</h4>
<p>there was a lot of discussion on the tracking issue that's probably lost now :(</p>



<a name="193832727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832727">(Apr 13 2020 at 23:05)</a>:</h4>
<p>including some of my ideas</p>



<a name="193832742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193832742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193832742">(Apr 13 2020 at 23:05)</a>:</h4>
<p>well, "lost" unless you dare to press the "show 9000 comments" button</p>



<a name="193833133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193833133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193833133">(Apr 13 2020 at 23:09)</a>:</h4>
<p>anyway I don't think we have to ban it directly, we can just handle it by unification limitations</p>



<a name="193833195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193833195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193833195">(Apr 13 2020 at 23:10)</a>:</h4>
<p>the WF conditions we're adding will require that you somehow request that <em>someone else</em> evaluate it</p>



<a name="193833266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193833266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193833266">(Apr 13 2020 at 23:10)</a>:</h4>
<p>and unification won't work except in the identity case (but we have to be careful with <code>Unevaluated</code> unification)</p>



<a name="193833276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193833276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193833276">(Apr 13 2020 at 23:10)</a>:</h4>
<p>yeah, I think these two facts protect us from anything unsavoury</p>



<a name="193833990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193833990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193833990">(Apr 13 2020 at 23:19)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> <span class="user-mention" data-user-id="126931">@centril</span> <a href="https://www.youtube.com/watch?v=21bUrFEX4jI&amp;t=1h2m17s" title="https://www.youtube.com/watch?v=21bUrFEX4jI&amp;t=1h2m17s">https://www.youtube.com/watch?v=21bUrFEX4jI&amp;t=1h2m17s</a></p>
<div class="youtube-video message_inline_image"><a data-id="21bUrFEX4jI" href="https://www.youtube.com/watch?v=21bUrFEX4jI&amp;t=1h2m17s" title="https://www.youtube.com/watch?v=21bUrFEX4jI&amp;t=1h2m17s"><img src="https://i.ytimg.com/vi/21bUrFEX4jI/default.jpg"></a></div>



<a name="193834071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193834071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193834071">(Apr 13 2020 at 23:20)</a>:</h4>
<p>I think I've seen this lecture at some point</p>



<a name="193834118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193834118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193834118">(Apr 13 2020 at 23:21)</a>:</h4>
<p>adjusted timestamp</p>



<a name="193834707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193834707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193834707">(Apr 13 2020 at 23:28)</a>:</h4>
<p>also wow, I am being informed GHC went an interesting route</p>



<a name="193834719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193834719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193834719">(Apr 13 2020 at 23:28)</a>:</h4>
<ul>
<li>tired: <a href="https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/kind-polymorphism-and-promotion.html#promotion" title="https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/kind-polymorphism-and-promotion.html#promotion">https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/kind-polymorphism-and-promotion.html#promotion</a></li>
<li>wired: <a href="https://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.html#overview-of-type-in-type" title="https://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.html#overview-of-type-in-type">https://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.html#overview-of-type-in-type</a></li>
</ul>



<a name="193834741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193834741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193834741">(Apr 13 2020 at 23:28)</a>:</h4>
<blockquote>
<p>&lt;eternaleye&gt; So yeah, GHC 7 had spirit mediums, but GHC 8 decided that we've all been dead all along</p>
</blockquote>



<a name="193835035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835035">(Apr 13 2020 at 23:32)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  yeah, TypeInType is part of the move towards Dependent Haskell</p>



<a name="193835039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835039">(Apr 13 2020 at 23:32)</a>:</h4>
<p>I'd recommend taking a look at Richard Eisenberg's thesis</p>



<a name="193835046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835046">(Apr 13 2020 at 23:32)</a>:</h4>
<p>ahhhhh GHC is attempting to die and go to heaven</p>



<a name="193835101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835101">(Apr 13 2020 at 23:33)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> what does that mean?</p>



<a name="193835111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835111">(Apr 13 2020 at 23:33)</a>:</h4>
<p>just trying to stretch eternaleye's joke even further :P</p>



<a name="193835122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835122">(Apr 13 2020 at 23:33)</a>:</h4>
<p>ah</p>



<a name="193835190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835190">(Apr 13 2020 at 23:34)</a>:</h4>
<p>GHC doubled down on inconsistency there instead of going with cumulative universes or whatnot</p>



<a name="193835208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835208">(Apr 13 2020 at 23:34)</a>:</h4>
<p>inconsistency in a UX or semantics sense?</p>



<a name="193835236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193835236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193835236">(Apr 13 2020 at 23:35)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span>  "inconsistency as a logic" sense, given <code>Type :: Type</code></p>



<a name="193839952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193839952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193839952">(Apr 14 2020 at 00:45)</a>:</h4>
<p><a href="/user_uploads/4715/CyIIk3NXH3fE7xK67m2PPka9/image.png" title="image.png">eternaleye made this</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/CyIIk3NXH3fE7xK67m2PPka9/image.png" title="eternaleye made this"><img src="/user_uploads/4715/CyIIk3NXH3fE7xK67m2PPka9/image.png"></a></div>



<a name="193840096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193840096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193840096">(Apr 14 2020 at 00:47)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> ^^</p>



<a name="193840174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/const%20generics%20in%20const%20fn/near/193840174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/const.20generics.20in.20const.20fn.html#193840174">(Apr 14 2020 at 00:48)</a>:</h4>
<p>"What would Girard say" :D</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>